-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: incorporates ParitySharesNamespace and TailPaddingNamespace into IsReserved function #2194
Conversation
…ace' into sanaz/extends-is-reserved-namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I like the addition of "primary". Should we also update it in the specs?
celestia-app/specs/src/specs/namespace.md
Line 77 in 78e5327
| `MAX_RESERVED_NAMESPACE` | `Namespace` | `0x00000000000000000000000000000000000000000000000000000000FF` | Max reserved namespace is lexicographically the largest namespace that is reserved for protocol use. | |
|
d09f934
to
7c76ff6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change
specs/src/specs/namespace.md
Outdated
In addition to the items listed in this table, it should be noted that namespaces with values less than `0x00000000000000000000000000000000000000000000000000000000FF` are exclusively reserved for use within the Celestia protocols. | ||
Reserved namespaces fall into two categories, _Primary Reserved Namespaces_ and _Secondary Reserved Namespaces_. | ||
- Primary Reserved Namespaces: Namespaces with values less than or equal to `0x00000000000000000000000000000000000000000000000000000000FF` are referred to as Primary Reserved Namespace and are exclusively reserved for use within the Celestia protocols. | ||
- Secondary Reserved Namespaces: Currently, there are two secondary reserved namespaces, namely, `PARITY_SHARE_NAMESPACE` and `TAIL_PADDING_NAMESPACE` which fall out of the range of primary reserved namespaces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever want to give ourselves some padding so we can add secondary namespaces in the future? The same we do with primary?
} | ||
|
||
if ns.IsParityShares() { | ||
return ErrParitySharesNamespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these errors used anywhere else? Do we want to remove them if they aren't used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After integrating this PR, there will be no active usage for ErrParitySharesNamespace
in the app. I also initially thought of deleting it, however, there are other unused errors among the existing registered errors e.g., ErrInvalidShareCommitments, so I decided to keep it as is. @rootulp Do you think there will be future usage for this error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect future usages of ErrParitySharesNamespace
so it seems feasible to remove but we can def do in a follow-up issue / PR.
One question I have is: when we delete errors that are no longer used, do we need to reserve the error code indefinitely or can it be repurposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a related note, sometimes some errors are not used but kept so that their code number is not replaced by some other error which might break downstream for people depending on it
Edit: Rootul front ran me :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too sure who uses the error code since the message is always accompanied with it in the response but I'd tend to agree that safest thing to do would be to reserve it (just by leaving a comment probably)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the specs change! Thanks for pushing this through
} | ||
|
||
if ns.IsParityShares() { | ||
return ErrParitySharesNamespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a related note, sometimes some errors are not used but kept so that their code number is not replaced by some other error which might break downstream for people depending on it
Edit: Rootul front ran me :D
d3b29c8
…ace' into sanaz/extends-is-reserved-namespace
Codecov Report
@@ Coverage Diff @@
## main #2194 +/- ##
==========================================
- Coverage 24.89% 24.86% -0.03%
==========================================
Files 127 127
Lines 14335 14326 -9
==========================================
- Hits 3568 3562 -6
+ Misses 10400 10397 -3
Partials 367 367
|
…to IsReserved function (#2194) Closes ##2138 This PR also addresses the concerns raised in the [comment](#2138 (comment)) by introducing a distinction between two types of reserved namespaces. Namespaces within the range [0-255] are now identified as "Primary Reserved Namespaces," while any other reserved namespaces beyond this range are categorized as "Non-Primary Reserved Namespaces." Hopefully, this differentiation provides better clarity and organization regarding namespace allocation and usage within the code. - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [x] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords
…to IsReserved function (#2194) ## Overview Closes ##2138 This PR also addresses the concerns raised in the [comment](#2138 (comment)) by introducing a distinction between two types of reserved namespaces. Namespaces within the range [0-255] are now identified as "Primary Reserved Namespaces," while any other reserved namespaces beyond this range are categorized as "Non-Primary Reserved Namespaces." Hopefully, this differentiation provides better clarity and organization regarding namespace allocation and usage within the code. ## Checklist - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [x] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords (cherry picked from commit b3b8611) # Conflicts: # pkg/namespace/consts.go # pkg/namespace/namespace.go # specs/src/specs/namespace.md
Overview
Closes ##2138
This PR also addresses the concerns raised in the comment by introducing a distinction between two types of reserved namespaces. Namespaces within the range [0-255] are now identified as "Primary Reserved Namespaces," while any other reserved namespaces beyond this range are categorized as "Non-Primary Reserved Namespaces." Hopefully, this differentiation provides better clarity and organization regarding namespace allocation and usage within the code.
Checklist